package org.poem;


import org.poem.entity.JSR250WayBeanDemo;
import org.poem.entity.SpringBootBeanDemo;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@SpringBootApplication
public class Main {

    @Bean
    public JSR250WayBeanDemo getJSR250WayBeanDemo(){
        return  new JSR250WayBeanDemo();
    }

    @Bean(initMethod = "initMethod",destroyMethod = "destoryMethod")
    public SpringBootBeanDemo getSpringBootBeanDemo(){
        return new SpringBootBeanDemo();
    }
    public static void main(String[] args) {
        AnnotationConfigApplicationContext configApplicationContext = new AnnotationConfigApplicationContext(Main.class);
        JSR250WayBeanDemo jsr250WayBeanDemo = configApplicationContext.getBean(JSR250WayBeanDemo.class);
        SpringBootBeanDemo springBootBeanDemo = configApplicationContext.getBean(SpringBootBeanDemo.class);
        configApplicationContext.close();
    }
}
